package com.dongdongshop.controller;

import com.dongdongshop.constant.CacheConstant;
import com.dongdongshop.data.Result;
import com.dongdongshop.domain.vo.AreasVO;
import com.dongdongshop.domain.vo.CitiesVO;
import com.dongdongshop.service.CitiesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("cities")
public class CitiesController {

    @Autowired
    private CitiesService citiesService;

    //根据省id查询对应市区
    @PostMapping
    public Result getCitiesByProvinceId(@RequestParam String provinceId){
        List<CitiesVO> citiesVOList = citiesService.getCitiesByProvinceId(provinceId);
        return Result.OK().setData(citiesVOList);
    }

}
